home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / swtools / trubasic / rolldemos / demos / ip / IFFgl < prev    next >
Encoding:
Text File  |  1994-08-02  |  877 b   |  36 lines

  1. ! module for True BASIC image processing toolkit
  2. ! routines for True BASIC for the Silicon Graphics Graphics Library
  3. ! note: images here use the origin in the upper left corner
  4. module IFFgl
  5.  
  6. ! load image in file a$ and return the size in xmax,ymax
  7. ! cmax is the largest color index contained in the image
  8. sub IFFload(a$,xmax,ymax,cmax)
  9. call diagnostics(1)
  10.     call tw_wset_size(0,420,308)
  11.     set mode "rgb"
  12.         ask pixels px,py
  13.     set window 0,px-1,0,py-1
  14.     call readimage("eye.rgb",0,0,xmax,ymax,cmax)
  15.  
  16.     ! move image to upper right corner
  17.     box keep 0,xmax,0,ymax in temp$
  18.     clear
  19.     box show temp$ at 0,py-ymax
  20.     set window 0,px,py,0
  21.     get point x,y
  22.     let temp$=""
  23. end sub
  24. sub PicBuf(x1,x2,y1,y2,buffer$())
  25.     mat redim buffer$(0:y1-y2)
  26.     for i=y2 to y1 
  27.             let st=1
  28.          for j=x1 to x2
  29.             call packb(buffer$(i),st,8,readpixel(j,i))
  30.             let st=st+8
  31.         next j
  32.     next i
  33. end sub
  34.  
  35. end module
  36.